/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bitoon.basketdudes.jpa;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author paco
 */
@Entity
@Table(name = "partner_usuario",schema="central")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PartnerUsuario.findAll", query = "SELECT p FROM PartnerUsuario p"),
    @NamedQuery(name = "PartnerUsuario.findById", query = "SELECT p FROM PartnerUsuario p WHERE p.id = :id"),
    @NamedQuery(name = "PartnerUsuario.findByPartnerIdyEmail", query = "SELECT p FROM PartnerUsuario p WHERE p.partnerId = :partner_id and p.remoteEmail = :remote_email"),
    @NamedQuery(name = "PartnerUsuario.findByRemoteEmail", query = "SELECT p FROM PartnerUsuario p WHERE p.remoteEmail = :remote_email"),
    @NamedQuery(name = "PartnerUsuario.findByRemoteId", query = "SELECT p FROM PartnerUsuario p WHERE p.partnerId = :partner_id and p.remoteId = :remote_id"),
    @NamedQuery(name = "PartnerUsuario.findByRemoteNick", query = "SELECT p FROM PartnerUsuario p WHERE p.partnerId = :partner_id and p.remoteNick = :remote_nick")})
public class PartnerUsuario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "partner_id")
    private short partnerId;
    @Size(max = 120)
    @Column(name = "remote_email")
    private String remoteEmail;
    @Column(name = "remote_id")
    private Integer remoteId;
    @Size(max = 50)
    @Column(name = "remote_nick")
    private String remoteNick;

    @ManyToOne
    @JoinColumn(name="usuario_id", referencedColumnName = "id")
    private Usuario usuario;
    
    
    public PartnerUsuario() {
    }

    public PartnerUsuario(Integer id) {
        this.id = id;
    }

    public PartnerUsuario(Integer id, short partnerId) {
        this.id = id;
        this.partnerId = partnerId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public short getPartnerId() {
        return partnerId;
    }

    public void setPartnerId(short partnerId) {
        this.partnerId = partnerId;
    }

    public String getRemoteEmail() {
        return remoteEmail;
    }

    public void setRemoteEmail(String remoteEmail) {
        this.remoteEmail = remoteEmail;
    }

    public Integer getRemoteId() {
        return remoteId;
    }

    public void setRemoteId(Integer remoteId) {
        this.remoteId = remoteId;
    }

    public String getRemoteNick() {
        return remoteNick;
    }

    public void setRemoteNick(String remoteNick) {
        this.remoteNick = remoteNick;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PartnerUsuario)) {
            return false;
        }
        PartnerUsuario other = (PartnerUsuario) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bitoon.basketdudes.jpa.PartnerUsuario[ id=" + id + " ]";
    }
    
}
